<!DOCTYPE html>
<html lang="zh-CN">

<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
    <meta name="author" content="李愧愧">
    <title></title>
    <style>

    </style>
</head>

<body>

    <script>
        var arr = [1, 2, 3, 4, 5, 6, 7, 89, 5, 2, 3, 6];
        var max = 0;

        function maxNum(arr) {
            for (var i = 0; i < arr.length; i++) {
                if (max < arr[i]) {
                    max = arr[i];
                }
            }
            alert('最大值为：'+max);
        }
        maxNum(arr);
    </script>
</body>
<ml>